package config

import (
	"time"
)

type Config struct {
	App       app
	Captcha   captcha
	Log       log
	View      view
	Language  language
	Redis     redis
	Mysql     mysql
	Mongodb   mongodb
	Session   session
	Websocket websocket
}

type app struct {
	Host string
	Port string
	Mode string
}

type bgColor struct {
	R uint8
	G uint8
	B uint8
	A uint8
}

type captcha struct {
	Height               int
	Width                int
	NoiseCount           int
	OptionShowHollowLine int
	OptionShowSlimeLine  int
	OptionShowSineLine   int
	Length               int
	Source               string
	BgColor              *bgColor
}

type log struct {
	Level       string
	FileName    string
	MaxSize     int
	LocalTIme   bool
	IsJson      bool
	Prefix      string
	Length      int
	EncodeLevel string
	Stacktrace  string
}

type view struct {
	IsLoad       bool
	Path         string
	IsLoadStatic bool
	StaticPath   string
}

type language struct {
	Path                string
	Default             string
	Type                string
	UrlParameterName    string
	HeaderParameterName string
	Lang                []string
}

type redis struct {
	Host        string
	Password    string
	Db          int
	MaxIdle     int
	MaxActive   int
	IdleTimeout time.Duration
}

type mysql struct {
	User         string
	Password     string
	Host         string
	Port         string
	Dbname       string
	Charset      string
	MaxIdleConns int
	MaxOpenConns int
}

type mongodb struct {
	User           string
	Password       string
	Host           string
	Port           string
	Dbname         string
	SetMaxPoolSize uint64
}

type session struct {
	Store         string
	MaxAge        int
	Name          string
	StorageFormat string
}

type websocket struct {
	Start                 int
	WriteReadBufferSize   int
	MaxMessageSize        int64
	PingPeriod            time.Duration
	HeartbeatFailMaxTimes int
	ReadDeadline          time.Duration
	WriteDeadline         time.Duration
}
